package com.quyunshuo.module.home.room.entity

import androidx.room.Entity
import androidx.room.PrimaryKey
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

@Entity(tableName = "app_usage")
data class AppUsageEntity(
    @PrimaryKey val packageName: String,
    val appName: String,
    val duration: Long, // 毫秒
    val lastTimeUsed: Long, // 时间戳
    val timestamp: Long = System.currentTimeMillis() // 记录时间
) {
    fun formattedDate(): String {
        return SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()).format(Date(timestamp))
    }
}